import datetime
from haystack import indexes
from haystack.sites import site
from Ebidding.auction.models import Item


class ItemIndex(indexes.SearchIndex):
    Name = indexes.CharField(document=True, use_template=True)
    
    Description=indexes.CharField(model_attr='Description')
    date = indexes.DateTimeField(model_attr='date')

    def get_query_set(self):
        "Used when the entire index for model is updated."
        return Item.objects.filter(date__lte=datetime.datetime.now())


site.register(Item, ItemIndex)

